home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hardcore Visual Basic 5.0 (2nd Edition)
/
Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso
/
Code
/
Goodies
/
CallBack
/
WINDENUM.CLS
< prev
Wrap
Text File
|
1997-06-09
|
1KB
|
48 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "WindowEnumerator"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private m_CallBack As CallBack
Private m_Recurse As Boolean 'Public variables aren't allowed
Function WNDENUMPROC(ByVal hWnd As Long, LParam As ListBox) As Long
Dim strTitle As String
Dim iLength As Long
If IsWindowVisible(hWnd) Then
strTitle = String$(128, 0)
iLength = GetWindowText(hWnd, strTitle, 128)
If iLength Then
With LParam
.AddItem Left$(strTitle, iLength)
.ItemData(.NewIndex) = hWnd
End With
End If
If m_Recurse Then EnumChildWindows hWnd, ProcAddress, LParam
End If
WNDENUMPROC = 1
End Function
Private Sub Class_Initialize()
Set m_CallBack = NewCallBack(CBType_WNDENUMPROC, Me, True)
m_Recurse = True
End Sub
Public Property Get ProcAddress() As Long
ProcAddress = m_CallBack.ProcAddress
End Property
Public Property Let Recurse(Value As Boolean)
m_Recurse = Value
End Property
Public Property Get Recurse() As Boolean
Recurse = m_Recurse
End Property